/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import koneksi.CekKoneksi;

/**
 *
 * @author priska
 */
public class beanLogin {
    public void cekLogin(Login lg) throws SQLException {


//        boolean status = false;
        Connection con = CekKoneksi.open();
        Statement st = null;

        String user = lg.getUsername();
        String pass = lg.getPassword();



        st = con.createStatement();

        String sql = "select jabatan from pegawai2 where username='" + user + "' and password='" + pass + "'";
        ResultSet rs = null;
        rs = st.executeQuery(sql);
        while (rs.next()) {

            lg.setCabang(rs.getString("jabatan"));
        }

    }
}
